package com.chen.servicemap.controller;

import com.chen.internalcommon.dto.ResponseResult;
import com.chen.internalcommon.request.ForecastPriceRequest;
import com.chen.servicemap.service.DirectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenLiuPing
 **/
@Slf4j
@RestController
@RequestMapping("/direction")
public class DirectionController {

    @Autowired
    private DirectionService directionService;

    @GetMapping("/driving")
    public ResponseResult driving(@RequestBody ForecastPriceRequest forecastPriceRequest) {
        log.info("driving start");
        String depLongitude = forecastPriceRequest.getDepLongitude();
        String depLatitude = forecastPriceRequest.getDepLatitude();
        String destLongitude = forecastPriceRequest.getDestLongitude();
        String destLatitude = forecastPriceRequest.getDestLatitude();
        log.info("出发地经度；{}", depLongitude);
        log.info("出发地纬度：{}", depLatitude);
        log.info("目的地经度：{}", destLongitude);
        log.info("目的地纬度：{}", destLatitude);
        return directionService.driving(depLongitude, depLatitude, destLongitude, destLatitude);
    }
}
